import {
    getFineJsonAPI,
    getMapDataListAPI, getOrgDetailFineJsonAPI, getOrgDetailJsonAPI,
    getOrgJsonAPI,
    getPersonJsonAPI, getPieFineJsonAPI, getPieJsonAPI,
    getTotalJsonAPI
} from "../../api/fileAnalysisAPI";

const fileAnalysis = {
    state: {
        totalJson: {
            num: 268,
            max: 62,
            content: {
                "一月": 3,
                "二月": 3,
                "三月": 4,
                "四月": 4,
                "五月": 14,
                "六月": 20,
                "七月": 47,
                "八月": 50,
                "九月": 61,
                "十月": 62,
                "十一月": 0,
                "十二月": 0,
            }
        },
        fineJson: {
            num: 55,
            max: 10,
            content: {
                "一月": 1,
                "二月": 2,
                "三月": 3,
                "四月": 4,
                "五月": 5,
                "六月": 6,
                "七月": 7,
                "八月": 8,
                "九月": 9,
                "十月": 10,
                "十一月": 0,
                "十二月": 0,
            }
        },
        orgJson: {
            num: 268,
            max: 62,
            content: {
                "开发性金融机构": 3,
                "金融租赁公司": 3,
                "农村合作银行": 4,
                "民营银行": 4,
                "村镇银行": 14,
                "农村信用社": 20,
                "城市商业银行": 47,
                "农村商业银行": 50,
                "股份制商业银行": 61,
                "国有大型商业银行": 62,
            }
        },
        personJson: {
            num: 55,
            max: 10,
            content: {
                "张一": 1,
                "张二": 2,
                "张三": 3,
                "张四": 4,
                "张五": 5,
                "张六": 6,
                "张七": 7,
                "张八": 8,
                "张九": 9,
                "张十": 10,
            }
        },
        pieJson: {
            num: 55,
            max: 10,
            content: {
                "张一": 1,
                "张二": 2,
                "张三": 3,
                "张四": 4,
                "张五": 5,
                "张六": 6,
                "张七": 7,
                "张八": 8,
                "张九": 9,
                "张十": 10,
            }
        },
        pieFineJson: {
            num: 55,
            max: 10,
            content: {
                "张一": 1,
                "张二": 2,
                "张三": 3,
                "张四": 4,
                "张五": 5,
                "张六": 6,
                "张七": 7,
                "张八": 8,
                "张九": 9,
                "张十": 10,
            }
        },
        orgDetailJson: {
            num: 268,
            max: 62,
            content: {
                "开发性金融机构": 3,
                "金融租赁公司": 3,
                "农村合作银行": 4,
                "民营银行": 4,
                "村镇银行": 14,
                "农村信用社": 20,
                "城市商业银行": 47,
                "农村商业银行": 50,
                "股份制商业银行": 61,
                "国有大型商业银行": 62,
            }
        },
        orgDetailFineJson: {
            num: 268,
            max: 62,
            content: {
                "开发性金融机构": 3,
                "金融租赁公司": 3,
                "农村合作银行": 4,
                "民营银行": 4,
                "村镇银行": 14,
                "农村信用社": 20,
                "城市商业银行": 47,
                "农村商业银行": 50,
                "股份制商业银行": 61,
                "国有大型商业银行": 62,
            }
        },
        dataList: [
            {
                name: "南海诸岛",
                value: 100,
                fine: 10,
            },
            {
                name: "北京",
                value: 540,
                fine: 10
            },
            {
                name: "天津",
                value: 130
            },
            {
                name: "上海",
                value: 400
            },
            {
                name: "重庆",
                value: 750
            },
            {
                name: "河北",
                value: 130
            },
            {
                name: "河南",
                value: 830
            },
            {
                name: "云南",
                value: 110
            },
            {
                name: "辽宁",
                value: 19
            },
            {
                name: "黑龙江",
                value: 150
            },
            {
                name: "湖南",
                value: 690
            },
            {
                name: "安徽",
                value: 60
            },
            {
                name: "山东",
                value: 39
            },
            {
                name: "新疆",
                value: 4
            },
            {
                name: "江苏",
                value: 31
            },
            {
                name: "浙江",
                value: 104
            },
            {
                name: "江西",
                value: 36
            },
            {
                name: "湖北",
                value: 52
            },
            {
                name: "广西",
                value: 33
            },
            {
                name: "甘肃",
                value: 7
            },
            {
                name: "山西",
                value: 5
            },
            {
                name: "内蒙古",
                value: 778
            },
            {
                name: "陕西",
                value: 22
            },
            {
                name: "吉林",
                value: 4
            },
            {
                name: "福建",
                value: 18
            },
            {
                name: "贵州",
                value: 5
            },
            {
                name: "广东",
                value: 98
            },
            {
                name: "青海",
                value: 1
            },
            {
                name: "西藏",
                value: 0
            },
            {
                name: "四川",
                value: 44
            },
            {
                name: "宁夏",
                value: 4
            },
            {
                name: "海南",
                value: 22
            },
            {
                name: "台湾",
                value: 3
            },
            {
                name: "香港",
                value: 5
            },
            {
                name: "澳门",
                value: 555
            }
        ]
    },
    mutations: {
        set_totalJson: function (state, data) {
            state.totalJson = data;
        },
        set_fineJson: function (state, data) {
            state.fineJson = data;
        },
        set_orgJson: function (state, data) {
            state.orgJson = data;
        },
        set_personJson: function (state, data) {
            state.personJson = data;
        },
        set_pieJson: function (state, data) {
            state.pieJson = data;
        },
        set_pieFineJson: function (state, data) {
            state.pieFineJson = data;
        },
        set_orgDetailJson: function (state, data) {
            state.orgDetailJson = data;
        },
        set_orgDetailFineJson: function (state, data) {
            state.orgDetailFineJson = data;
        },
        set_mapDataList: function (state, data) {
            state.dataList = data;
        }
    },
    actions: {
        get_totalJson: async function ({commit}, filter) {
            let res = await getTotalJsonAPI(filter);
            console.log(res);
            if (res) {
                commit("set_totalJson", res);
                return res;
            } else {
                throw "";
            }
        },
        get_fineJson: async function ({commit}, filter) {
            let res = await getFineJsonAPI(filter);
            if (res) {
                commit("set_fineJson", res);
                return res;
            } else {
                throw "";
            }
        },
        get_orgJson: async function ({commit}, filter) {
            let res = await getOrgJsonAPI(filter);
            if (res) {
                commit("set_orgJson", res);
                return res;
            } else {
                throw "";
            }
        },
        get_personJson: async function ({commit}, filter) {
            let res = await getPersonJsonAPI(filter);
            if (res) {
                commit("set_personJson", res);
                return res;
            } else {
                throw "";
            }
        },
        get_mapDataList: async function ({commit}, filter) {
            let res = await getMapDataListAPI(filter);
            if (res) {
                commit("set_mapDataList", res);
                return res;
            } else {
                throw "";
            }
        },
        get_orgDetailJson: async function ({commit}, filter) {
            let res = await getOrgDetailJsonAPI(filter);
            if (res) {
                commit("set_orgDetailJson", res);
                return res;
            } else {
                throw "";
            }
        },
        get_orgDetailFineJson: async function ({commit}, filter) {
            let res = await getOrgDetailFineJsonAPI(filter);
            if (res) {
                commit("set_orgDetailFineJson", res);
                return res;
            } else {
                throw "";
            }
        },
        get_pieJson: async function ({commit}, filter) {
            let res = await getPieJsonAPI(filter);
            if (res) {
                commit("set_pieJson", res);
                return res;
            } else {
                throw "";
            }
        },
        get_pieFineJson: async function ({commit}, filter) {
            let res = await getPieFineJsonAPI(filter);
            if (res) {
                commit("set_pieFineJson", res);
                return res;
            } else {
                throw "";
            }
        },
    }
};

export default fileAnalysis;